#pragma once

#ifndef SIMULATOR_UTIL
#define SIMULATOR_UTIL

#include <stdio.h>

#ifdef _DEBUG

#define DbgPrint(x,...)		printf(x,##__VA_ARGS__)

#else

#define DbgPrint(x,...)		

#endif // DEBUG

enum LOG_LEVEL
{
	LOG_LEVEL_OFF = 0,
	LOG_LEVEL_ERR,
	LOG_LEVEL_WARN,
	LOG_LEVEL_INFO,
};

extern enum  LOG_LEVEL logger;
#define log_err(x,...) \
	do\
	{\
		if(logger >= LOG_LEVEL_ERR)\
			DbgPrint("err ->FUNC[%s] LINE[%d]:"x"\r\n",__func__,__LINE__,##__VA_ARGS__);\
	} while (0)

#define log_warn(x,...) \
	do\
	{\
		if(logger >= LOG_LEVEL_WARN)\
			DbgPrint("warn->FUNC[%s] LINE[%d]:"x"\r\n",__func__,__LINE__,##__VA_ARGS__);\
	} while (0)

#define log_info(x,...) \
	do\
	{\
		if(logger >= LOG_LEVEL_INFO)\
			DbgPrint("info->FUNC[%s] LINE[%d]:"x"\r\n",__func__,__LINE__,##__VA_ARGS__);\
	} while (0)

void abortEx(char* err);

#define SIMU_BUILD_BUG_MSG(x, msg) _Static_assert(!(x), msg)

#endif // !SIMULATOR_UTIL
